package pl.enigmatic.test;

import java.awt.BorderLayout;

import javax.swing.JComponent;
import javax.swing.JPanel;


public class NamedPanel extends JPanel implements INamedPanel {

	/** */
	private static final long serialVersionUID = 1L;
	protected final String name;
	protected final JPanel panel;

	public NamedPanel(final String name) {
		this.name = name;
		panel = this;
	}

	public NamedPanel(final JPanel panel, final String name) {
		this.name = name;
		this.panel = panel;
	}

	public NamedPanel(final JComponent c, final String name) {
		this(name);
		setLayout(new BorderLayout());
		add(c, BorderLayout.CENTER);
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public JPanel getPanel() {
		return panel;
	}

}